﻿using Entity.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace Entity.Models.Entities
{
    /// <summary>
    /// 文件信息表
    /// </summary>
    public class FileInfo: BaseEntity
    {
        /// <summary>
        /// 关系id
        /// </summary>
        [Column(TypeName = "varchar(36)")]
        public string RelationId { get; set; }

        /// <summary>
        /// 原文件名
        /// </summary>
        [Column(TypeName = "varchar(32)")]
        public string OldFileName { get; set; }

        /// <summary>
        /// 新文件名
        /// </summary>
        [Column(TypeName = "varchar(32)")]
        public string NewFileName { get; set; }


        /// <summary>
        /// 拓展名
        /// </summary>
        [Column(TypeName = "varchar(12)")]
        public string Extension { get; set; }

        /// <summary>
        /// 文件大小
        /// </summary>
        public double Length { get; set; }


        /// <summary>
        /// 添加人Id
        /// </summary>
        [Column(TypeName = "varchar(32)")]
        public string Creator { get; set; }

        /// <summary>
        /// 类别
        /// </summary>
        public FileInfoTypeEnums Category { get; set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        public FileInfo(string relationId, string oldFileName, string newFileName, string extension, long length, string creator, FileInfoTypeEnums category)
        {
            Id = Guid.NewGuid().ToString();
            RelationId = relationId;
            OldFileName = oldFileName;
            NewFileName = newFileName;
            Extension = extension;
            Length = length;
            Creator = creator;
            Category = category;
            CreateTime = DateTime.Now;
        }

        public FileInfo()
        {
        }
    }
}
